// 播放相关接口

// /song/url/v1

import { AxiosResponse } from "axios";
import request from "../utils/request";
import { LevelType, SongUrlData, LyricDataType } from "@/types/player";
import { PlayListSong } from "@/types/album";

export function getSongUrl(id: number, level: LevelType) {
  return request<{
    code: number;
    data: SongUrlData[];
  }>({
    url: "/song/url/v1",
    method: "get",
    params: {
      id,
      level,
    },
  });
}

export function getSongDetail(ids: string) {
  return request<{
    code: number;
    songs: PlayListSong[];
  }>({
    url: "/song/detail",
    method: "get",
    params: { ids },
  });
}

type LyricDataRes = LyricDataType & {
  code: 200;
};

export function getSongLyric(id: number | string) {
  return request<LyricDataRes>({
    url: "/lyric",
    method: "get",
    params: { id },
  });
}
